package com.whmall.service.crm.module.supplierreview;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 供应商评论业务类型
 *
 * @author alex
 * @since 2021/1/18
 */
public enum SupplierReviewBusinessTypeEnum {
    /**
     * 询盘
     */
    INQUIRY(1),

    /**
     * 采购订单
     */
    ORDER_DETAIL(2),

    /**
     * 备货订单
     */
    STOCK_ORDER(3),

    /**
     * 公司
     */
    COMPANY(4);

    @JsonCreator
    public static SupplierReviewBusinessTypeEnum fromNullableValue(Integer value) {
        if (null == value) {
            return null;
        }

        return fromValue(value);
    }

    public static SupplierReviewBusinessTypeEnum fromValue(int value) {
        for (SupplierReviewBusinessTypeEnum anEnum : values()) {
            if (anEnum.getValue() == value) {
                return anEnum;
            }
        }

        throw new UnsupportedOperationException("不支持的供应商评论业务类型=" + value);
    }

    SupplierReviewBusinessTypeEnum(int value) {
        this.value = value;
    }

    private final int value;

    @JsonValue
    public int getValue() {
        return value;
    }
}
